<script lang="ts">
    import { Empty } from "../Empty";
    import Item from "./Item.svelte";

    const props = $props();
</script>

<div class={{ "cm-cascader-list": true, "cm-cascader-list-empty": !props.data.length }}>
    {#if props.data.length}
        {#each props.data as item (item)}
            {#if props.store.nodeMap[item]}
                <Item trigger={props.trigger} data={props.store.nodeMap[item]} store={props.store} level={props.level} />
            {/if}
        {/each}
    {:else}
        <div class="cm-cascader-empty">
            <Empty desc={props.emptyText} />
        </div>
    {/if}
</div>
